import java.util.TreeSet;

/**
* @description: 729. 我的日程安排表 I
* @author hewei
* @date 2022/8/19 15:23
* @version 1.0
*/

public class MyCalendar {

    TreeSet<int[]> treeSet;
    public MyCalendar() {
        treeSet = new TreeSet<>((a,b)->{
            if(a[0]>=b[1]){
                return 1;
            }else if (a[1]<=b[0]){
                return -1;
            }else{
                return 0;
            }
        });
    }

    public boolean book(int start, int end) {
        return treeSet.add(new int[]{start, end});
    }
}
